﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Web.Security;

namespace Web.Framework.Attributes
{

    /// <summary>
    /// 用户是否登录的检查类
    /// </summary>
    public class LoginAuthorizeAttribute : AuthorizeAttribute
    {
        #region - 方法 -

        //step.1
        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            base.OnAuthorization(filterContext);
        }

        //step.2
        protected override bool AuthorizeCore(System.Web.HttpContextBase httpContext)
        {
            //return httpContext.Session["user"] != null;
            return base.AuthorizeCore(httpContext);
        }

        //step.3
        protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
        {
            base.HandleUnauthorizedRequest(filterContext);
        }

        #endregion

    }
}
